/**
 * 构建请求地址模块
 */
layui.define(function (exports) {
    //基础地址
    //var baseUrl = 'http://120.76.138.242:8080/think/';
    //var baseUrl = 'http://www.anchangtu.zlact.com/xsxt/';
    var baseUrl = 'http://127.0.0.1:8080/yanuoDev/';

    String.prototype.restfulFormat = function (param) {
        var that = this;
        if (param === undefined || param === null || param === {}) {
            return this;
        }

        var keys = Object.keys(param);
        for (var i in keys) {
            var key = keys[i];
            that = that.replace(new RegExp("\\{" + key + "\\}", "g"), param[key]);
        }
        return that;
    };

    String.prototype.getPermissionUrl = function (param) {
        var that = this;
        if (param === undefined || param === null || param === {}) {
            return this;
        }
        return that.replace(baseUrl, param.toUpperCase() + ':');
    };

    //输出
    exports('reqApi', {
        admin: {
            home: {
                verifyCode: baseUrl + 'admin/home/verifyCode/{vc_token}'
                , token: baseUrl + 'oauth/token'
                , logout: baseUrl + 'admin/home/token'
                , selectUserInfo: baseUrl + 'admin/home/info'
                , updateUserInfo: baseUrl + 'admin/home/info'
                , updatePassword: baseUrl + 'admin/home/password'
                , menu: baseUrl + 'admin/home/menu'
                , enum: baseUrl + 'admin/home/{enumName}'
                , get: baseUrl + 'admin/home/remind/{id}'
            }
            , sysUser: {
                list: baseUrl + 'admin/sysUser'
                , batchUpdateState: baseUrl + 'admin/sysUser/batch-updateState'
                , batchDelete: baseUrl + 'admin/sysUser/batch-delete'
                , batchResetPwd: baseUrl + 'admin/sysUser/batch-resetPwd'
                , createOrUpdate: baseUrl + 'admin/sysUser'
                , setUserRole: baseUrl + 'admin/sysUser/setUserRole'
                , get: baseUrl + 'admin/sysUser/{id}'
                , selectList:baseUrl + 'admin/sysUser/selectList'
            }
            , role: {
                list: baseUrl + 'admin/role'
                , batchUpdateState: baseUrl + 'admin/role/batch-updateState'
                , batchDelete: baseUrl + 'admin/role/batch-delete'
                , createOrUpdate: baseUrl + 'admin/role'
                , setRoleResource: baseUrl + 'admin/role/setRoleResource'
                , get: baseUrl + 'admin/role/{id}'
                , all: baseUrl + 'admin/role/all'
            }
            , resource: {
                list: baseUrl + 'admin/resource'
                , batchUpdateState: baseUrl + 'admin/resource/batch-updateState'
                , batchUpdateParent: baseUrl + 'admin/resource/batch-updateParent'
                , batchDelete: baseUrl + 'admin/resource/batch-delete'
                , pResource: baseUrl + 'admin/resource/pResource'
                , all: baseUrl + 'admin/resource/all'
                , createOrUpdate: baseUrl + 'admin/resource'
                , get: baseUrl + 'admin/resource/{id}'
                , refreshResource: baseUrl + 'admin/resource/refreshResource'
            }
            ,mainCompany: {
                list: baseUrl + 'mainCompany',
                createOrUpdate: baseUrl + 'mainCompany',
                get: baseUrl + 'mainCompany/{id}',
                delete: baseUrl + 'mainCompany/delete',
                all: baseUrl + 'mainCompany/all',
            }
        },
		importUrl:{
			// localMainCustomerImportUrl : 'http://127.0.0.1/xsxt/view-admin/assets/downFile/客户信息表.xlsx',
            // localMainCarInfoImportUrl : 'http://127.0.0.1/xsxt/view-admin/assets/downFile/车辆信息表.xlsx',
            // mainCustomerImportUrl : '../view-admin/assets/downFile/客户信息表.xlsx',
            // mainCarInfoImportUrl : '../view-admin/assets/downFile/车辆信息表.xlsx',
		},
        baseUploadUrl : 'http://120.76.138.242:9100/',
    });
});
